#ifndef PARSER_H_
#define PARSER_H_

typedef enum _ESVG_Parser_Element
{
	ESVG_ELEMENT_UNKNOWN,
	ESVG_ELEMENT_A,
	ESVG_ELEMENT_ALTGLYPH,
	ESVG_ELEMENT_ALTGLYPHDEF,
	ESVG_ELEMENT_ALTGLYPHITEM,
	ESVG_ELEMENT_ANIMATE,
	ESVG_ELEMENT_ANIMATECOLOR,
	ESVG_ELEMENT_ANIMATEMOTION,
	ESVG_ELEMENT_ANIMATETRANSFORM,
	ESVG_ELEMENT_CIRCLE,
	ESVG_ELEMENT_CLIPPATH,
	ESVG_ELEMENT_COLOR_PROFILE,
	ESVG_ELEMENT_CURSOR,
	ESVG_ELEMENT_DEFINITION_SRC,
	ESVG_ELEMENT_DEFS,
	ESVG_ELEMENT_DESC,
	ESVG_ELEMENT_ELLIPSE,
	ESVG_ELEMENT_FEBLEND,
	ESVG_ELEMENT_FECOLORMATRIX,
	ESVG_ELEMENT_FECOMPONENTTRANSFER,
	ESVG_ELEMENT_FECOMPOSITE,
	ESVG_ELEMENT_FECONVOLVEMATRIX,
	ESVG_ELEMENT_FEDIFFUSELIGHTING,
	ESVG_ELEMENT_FEDISPLACEMENTMAP,
	ESVG_ELEMENT_FEDISTANTLIGHT,
	ESVG_ELEMENT_FEFLOOD,
	ESVG_ELEMENT_FEFUNCA,
	ESVG_ELEMENT_FEFUNCB,
	ESVG_ELEMENT_FEFUNCG,
	ESVG_ELEMENT_FEFUNCR,
	ESVG_ELEMENT_FEGAUSSIANBLUR,
	ESVG_ELEMENT_FEIMAGE,
	ESVG_ELEMENT_FEMERGE,
	ESVG_ELEMENT_FEMERGENODE,
	ESVG_ELEMENT_FEMORPHOLOGY,
	ESVG_ELEMENT_FEOFFSET,
	ESVG_ELEMENT_FEPOINTLIGHT,
	ESVG_ELEMENT_FESPECULARLIGHTING,
	ESVG_ELEMENT_FESPOTLIGHT,
	ESVG_ELEMENT_FETILE,
	ESVG_ELEMENT_FETURBULENCE,
	ESVG_ELEMENT_FILTER,
	ESVG_ELEMENT_FONT,
	ESVG_ELEMENT_FONT_FACE,
	ESVG_ELEMENT_FONT_FACE_FORMAT,
	ESVG_ELEMENT_FONT_FACE_NAME,
	ESVG_ELEMENT_FONT_FACE_SRC,
	ESVG_ELEMENT_FONT_FACE_URI,
	ESVG_ELEMENT_FOREIGNOBJECT,
	ESVG_ELEMENT_G,
	ESVG_ELEMENT_GLYPH,
	ESVG_ELEMENT_GLYPHREF,
	ESVG_ELEMENT_HKERN,
	ESVG_ELEMENT_IMAGE,
	ESVG_ELEMENT_LINE,
	ESVG_ELEMENT_LINEARGRADIENT,
	ESVG_ELEMENT_MARKER,
	ESVG_ELEMENT_MASK,
	ESVG_ELEMENT_METADATA,
	ESVG_ELEMENT_MISSING_GLYPH,
	ESVG_ELEMENT_MPATH,
	ESVG_ELEMENT_PATH,
	ESVG_ELEMENT_PATTERN,
	ESVG_ELEMENT_POLYGON,
	ESVG_ELEMENT_POLYLINE,
	ESVG_ELEMENT_RADIALGRADIENT,
	ESVG_ELEMENT_RECT,
	ESVG_ELEMENT_SCRIPT,
	ESVG_ELEMENT_SET,
	ESVG_ELEMENT_STOP,
	ESVG_ELEMENT_STYLE,
	ESVG_ELEMENT_SVG,
	ESVG_ELEMENT_SWITCH,
	ESVG_ELEMENT_SYMBOL,
	ESVG_ELEMENT_TEXT,
	ESVG_ELEMENT_TEXTPATH,
	ESVG_ELEMENT_TITLE,
	ESVG_ELEMENT_TREF,
	ESVG_ELEMENT_TSPAN,
	ESVG_ELEMENT_USE,
	ESVG_ELEMENT_VIEW,
	ESVG_ELEMENT_VKERN,
	ESVG_ELEMENTS,
} ESVG_Parser_Element;

typedef struct _ESVG_Parser
{
	ESVG_Engine *engine;
	ESVG_Document *document;
	ESVG_Svg *svg;
	EXML *xml;
} ESVG_Parser;

/* TODO the parser callback should have some kind of parent element reference
 * in case we need it: pass ESVG_Element too
 */

typedef Eina_Bool (*ESVG_Document_Element_Parser)(ESVG_Parser *parser, ESVG_Element *parent, ESVG_Element **new_element);

typedef struct _ESVG_Document_Element
{
	const ESVG_Parser_Element element;
	const ESVG_Parser_Element children[ESVG_ELEMENTS]; /* TODO why not a bitmask maybe too many?? */
	ESVG_Document_Element_Parser parser;
} ESVG_Document_Element;

extern char *element_tags[ESVG_ELEMENTS];

extern ESVG_Document_Element *esvg_elements[ESVG_ELEMENTS];
extern ESVG_Document_Element element_svg;
extern ESVG_Document_Element element_group;
extern ESVG_Document_Element element_rect;

#endif /*PARSER_H_*/
